@extends('layouts.app')

@section('title','ActivitiesList')
@section('css')
    <style>
        #deleteModel
        {
            top: 35%;
        }

        .modal-footer {
            padding: 0;
        }

        .modal-footer .btn-group button {
            height:40px;
            border-top-left-radius : 0;
            border-top-right-radius : 0;
            border: none;
            border-right: 1px solid #ddd;
        }

        .modal-footer .btn-group:last-child > button {
            border-right: 0;
        }
    </style>
@endsection
@section('content')
    <div class="container">
        <div class="row">
            <div class="col-md-12">
                <header class="list-header">
                    <section>活动列表</section>
                    <section>
                  
                        <a href="{{ route('activity.create')}}" class="add"><i class="fa fa-plus-circle fa-lg" aria-hidden="true"></i>&nbsp;添加活动</a>
                
                    </section>
                </header>
                <table class="table table-hover table-striped list-table">
                    <tr class="list-table-tr">
                        <th>活动名</th>
                        <th>活动地点</th>
                        <th>电话</th>
                        <th>活动简介</th>
                        <th>活动收费</th>
                        <th>参与人数</th>
                        <th>活动时间</th>
                        <th class="text-right">Operation</th>
                    </tr>

                    @foreach($activities as $v)
                        <tr>
                            <td>{{ $v->activity_name }}</td>
                            <td> {{$v->activity_place}}</td>
                            <td>{{ $v->activity_phone }}</td>
                            <td>{{$v->activity_intro}}</td>
                            <td>{{$v->activity_charge}}</td>
                            <td>{{$v->enrollments}}</td>
                            <td>{{$v->activity_date}}</td>
                            <td class="text-right">
                                <a  href="{{ URL('admin/activity/'.$v->id.'/edit') }}" class="edit">
                                    <i class="fa fa-pencil-square-o fa-lg" aria-hidden="true"></i>
                                </a>
                                <button type="submit" class="delete" data-toggle="modal" data-target="#deleteModel"><i class="fa fa-trash-o fa-lg" aria-hidden="true"></i></button>
                            </td>
                            <div class="modal fade bs-example-modal-sm" id="deleteModel" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
                                    <div class="modal-dialog modal-sm" role="document">
                                        <div class="modal-content">
                                            <div class="modal-header">
                                                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                                                <h4 class="modal-title" id="myModalLabel">确定删除吗？</h4>
                                            </div>
                                            <div class="modal-footer">
                                                <div class="btn-group btn-group-justified" role="group" aria-label="group button">
                                                    <div class="btn-group" role="group">
                                                        <form action="{{ URL('admin/activity/'.$v->id) }}" method="POST" style="display: inline;">
                                                            <input name="_method" type="hidden" value="DELETE">
                                                            <input type="hidden" name="_token" value="{{ csrf_token() }}">
                                                            <button type="submit" class="btn btn-default">确定</button>
                                                        </form>
                                                    </div>
                                                    <div class="btn-group" role="group">
                                                        <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                        </tr>
                    @endforeach
                </table>
                <hr>
                {!! $activities->render() !!}
                  
            </div>
        </div>
    </div>
@endsection